# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libksba

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.0
pkgrel=2
pkgdesc="A CMS and X.509 access library (mingw-w64)"
arch=('any')
license=('GPL')
url="ftp://ftp.gnupg.org/gcrypt/alpha/libksba"
depends=("${MINGW_PACKAGE_PREFIX}-libgpg-error")
groups=("${MINGW_PACKAGE_PREFIX}")
options=('strip' 'staticlibs')
source=(ftp://ftp.gnupg.org/gcrypt/$_realname/$_realname-$pkgver.tar.bz2
        0001-fix-def.mingw.patch)
md5sums=('cd86fad9c9d360b2cf80449f8a4a4075'
         '437ad992a8ac21ba7646f707b2b4a4f2')

prepare() {
  cd $srcdir/$_realname-$pkgver
  patch -p1 -i ${srcdir}/0001-fix-def.mingw.patch
}

build() {
  mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}
  ../$_realname-$pkgver/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-shared --disable-static
  make
}

check() {
   cd ${srcdir}/build-${CARCH}
   make check
}  

package() {
  cd ${srcdir}/build-${CARCH}
  make -j1 DESTDIR=$pkgdir install
}
